package com.lanou.controller;

import com.lanou.service.T8TFurnitureCommodityService;
import com.lanou.utils.AjaxResult;
import com.lanou.utils.StrUtils;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.io.File;

/**
 * Created by dllo on 18/3/19.
 */
@Controller
public class T8TFurnitureCommodityController {

    @Resource
    private T8TFurnitureCommodityService t8TFurnitureCommodityService;


    /**
     * 郭中宏
     * @param classifyRoom 商品分类
     * @param pageNum 当前页数
     * @param pageSize 每页显示多少数据
     * @return 返回对应的商品信息
     */
    @ResponseBody
    @RequestMapping(value = "/findFurnitureCommodity")
    public AjaxResult findFurnitureCommodity(@RequestParam(value = "classifyRoom",required = false)String classifyRoom,@RequestParam(value = "pageNum",required = false)Integer pageNum,@RequestParam(value = "pageSize",required = false)Integer pageSize){
        classifyRoom= StrUtils.charSetStr(classifyRoom);
       return new AjaxResult("200","1.0",t8TFurnitureCommodityService.findFurnitureCommodity(classifyRoom,pageNum,pageSize));
    }



    @RequestMapping(value = "/searchForCommodity")
    public String searchForCommodity(@RequestParam("condition")String condition){
        condition=StrUtils.charSetStr(condition);
        switch (condition){
            case "建材":
              return "jiancai";
            case "家具":
                return "jiaju";
        }


        return null;
    }


}
